package zeno.project.springboot.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import zeno.project.springboot.entity.system.SysRole;
import zeno.project.springboot.entity.system.SysUser;

import java.util.List;
import java.util.Set;

/**
 * @author ZhiYong
 * @ClassName SysUserMapper.java
 * @Description 系统用户Mapper
 * @createTime 2021/04/18 18:30:00
 */
public interface SysUserMapper extends BaseMapper<SysUser> {
    List<SysRole> findAllById(Integer userId);

    /**
     * 根据登录名获取角色set
     * @param account 登录名
     * @return 角色code的set
     */
    Set<String> findRolesByAccount(String account);

    /**
     * 根据角色set获取权限set
     * @param roleCodes 角色set
     * @return 权限set
     */
    Set<String> findPermissionsByAccount(@Param("roleCodes") Set<String> roleCodes);

    SysUser getByAccount(String account);
}
